package eu.irreality.dai.gameplay.events;

import eu.irreality.dai.gameplay.entities.Entity;
import eu.irreality.dai.util.Position;
import eu.irreality.dai.world.level.Level;

/**
 * An Event that gets notified from the world to its observers.
 * 
 * @author carlos
 * 
 */
public class GameEvent
{

    public static int MOVE = 1;
    public static int TRY_TO_MOVE = 2;
    public static int OPEN_DOOR = 3;
    public static int CLOSE_DOOR = 4;
    public static int WHAT_DOOR = 5;

    /**
     * Create a new event specifying all the data that define it.
     * 
     * @param theLevel
     *            Game level in which the event happens.
     * @param position
     *            Position in the level in which the event happens.
     * @param subject
     *            Creature or object that triggers the event.
     * @param object
     *            Creature or object that is targeted by the event.
     * @param eventType
     *            Type of event that has happened.
     */
    public GameEvent(Level theLevel, Position position, Entity subject,
	    Entity object, int eventType)
    {
	this.theLevel = theLevel;
	this.position = position;
	this.subject = subject;
	this.object = object;
	this.eventType = eventType;
    }

    public Level getLevel()
    {
	return theLevel;
    }

    public Position getPosition()
    {
	return position;
    }

    public Entity getSubject()
    {
	return subject;
    }

    public Entity getObject()
    {
	return object;
    }

    public int getType()
    {
	return eventType;
    }

    /**
     * Level in which the event has happened.
     */
    private Level theLevel;

    /**
     * Position in which the event has happened (if any).
     */
    private Position position;

    /**
     * Entity which triggered the event (if any).
     */
    private Entity subject;

    /**
     * Entity which has been the object or target of the event (if any).
     */
    private Entity object;

    /**
     * Type of event that has happened.
     */
    private int eventType;

}
